<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>
  <script>
    var a = new RegExp("hello", "gi")
    console.log(a);
    var b = RegExp("hello", "i")
    console.log(b);
    var c = /hello/gi
    console.log(c);

    var str = "you How Are ARE you"
    var rg = /are/i
    console.log(rg.test(str));
    console.log(/are|you/ig.exec(str));

    console.log(str.match(/are/ig));

    console.log(str.replace(/are/ig, "*"));

    console.log(str.split(/are/i));
    var str = "1how\n2are\n3Are\n4ARE\n5you";
    console.log(str.replace(/^\d/ig, "*"));
    console.log(str.replace(/^\d/igm, "*"));
  </script>
</body>

</html>